ifneq (DEBUG, "-g")
	DEBUG += 
endif

IDIR = ../../include
CC = gcc
CPPFLAGS = -fopenmp -lpapi -Wall $(DEBUG) -I$(IDIR)

EXEC = gen_define.exe read64_independent.exe  peak.exe fitsincache.exe

all: $(EXEC)

.PHONY: all 

$(EXEC): %.exe : %.o test_utils.o
		  $(CC) test_utils.o $< -o $@ $(CPPFLAGS) 

$(OBJ): %.o : %.cpp 
		  $(CC) -o $@ -c $< $(CPPFLAGS)

test_utils.o: test_utils.c
		$(CC) $< -c -o $@ -I$(IDIR) $(CPPFLAGS)
.PHONY: debug
debug: clean
		  $(MAKE) $(MAKEFILE) all DEBUG="-g"

.PHONY: clean
clean:
	rm -f *.o *.exe
